package com.lmx.repoDomain.tmodel;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ForeignKey;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;

import io.katharsis.resource.annotations.JsonApiIncludeByDefault;
import io.katharsis.resource.annotations.JsonApiResource;
import io.katharsis.resource.annotations.JsonApiToOne;

/**
 * 
 */
@Entity
@JsonApiResource(type = "statquerytype")
@Table(name = "tnb_statquery_querytype")
// @JsonIgnoreProperties(value={"hibernateLazyInitializer","handler"})
public class StatQueryType extends BaseEntity {

	private Dicttype statType;// 类型

	private Dicttype statItem;// 口径

	@JsonApiToOne
	@JsonApiIncludeByDefault
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
	@Fetch(FetchMode.JOIN)
	@JoinColumn(name = "stat_type", nullable = true, foreignKey = @ForeignKey(name = "null"))
	public Dicttype getStatType() {
		return statType;
	}

	public void setStatType(Dicttype statType) {
		this.statType = statType;
	}

	@JsonApiToOne
	@JsonApiIncludeByDefault
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
	@Fetch(FetchMode.JOIN)
	@JoinColumn(name = "stat_item", nullable = true, foreignKey = @ForeignKey(name = "null"))
	public Dicttype getStatItem() {
		return statItem;
	}

	public void setStatItem(Dicttype statItem) {
		this.statItem = statItem;
	}

}